from django import forms
from web.forms.bootstrap import BootStrap

from web import models


class ProjectModelForm(BootStrap, forms.ModelForm):
    class Meta:
        model = models.Project
        fields = ['name', 'color', 'desc']
        widgets = {
            'desc': forms.Textarea
        }

    def clean_name(self):
        name = self.cleaned_data['name']
        # 1.校验项目是否存在 ()

        # 2. 校验当前用户的价格策略是否可以在继续添加项目

        return name
